import { menu } from "../../decorator";
import baseShap from "./base/baseShap";

const { ccclass, property } = cc._decorator;

@ccclass
@menu(__filename)
export default class shapCircle extends baseShap {
    @property
    _radius: number = 100
    @property({
        tooltip: '半径'
    })
    get radius() { return this._radius };
    set radius(value) {
        this._radius = value;
        this.node && this.node.emit('radius-change');
    };

    contains(nodePoint: cc.Vec2): boolean {
        return Math.pow(nodePoint.x - this.offset.x, 2) + Math.pow(nodePoint.y - this.offset.y, 2) <= Math.pow(this._radius, 2);
    }
}
